package com.inspinia.base.common.model;

/**
 * Created by Veblen on 2017/1/1.
 */
public enum ResourcesType implements NameCodeEnum {

    menu(1, "菜单"), resources(2, "资源");

    private final int code;
    private final String name;

    ResourcesType(int code, String name) {
        this.code = code;
        this.name = name;
    }

    @Override
    public int getCode() {
        return code;
    }

    @Override
    public String getName() {
        return name;
    }

    public static ResourcesType valueOf(int code) {
        for (ResourcesType type : ResourcesType.values()) {
            if (type.code == code) {
                return type;
            }
        }
        return null;
    }
    public static ResourcesType valueOfString(String code) {
        for (ResourcesType type : ResourcesType.values()) {
            if (type.name.equals(code)) {
                return type;
            }
        }
        return null;
    }
}
